<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <div id="box">
    {{text}}
    <br>

    <span v-for="(item,index) in arr">
      {{item}}<input type="checkbox" name="" :value="item" @click="btn(item,$event)" id="">
    </span>

    <ul>
      <li v-for="item in itemarr">
        {{item}}
      </li>
    </ul>

  </div>
  <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.14/vue.js"></script>
  <script>


    new Vue({
      el: '#box',
      data: {
        text: 'hello Vue',
        arr: ["科幻", "喜剧", "动漫", "冒险", "科技", "军事", "娱乐", "奇闻"],
        itemarr: []
      },
      methods: {

        btn (item, e) {
          // console.log(e.target.value);
          // console.log(e.target.checked);

          this.itemarr.push(e.target.value)
          if (e.target.checked === false) {
            this.itemarr = this.itemarr.filter(item => item !== e.target.value)
          }


        }


      }
    })





  </script>

</body>

</html>